package com.caption.api.handle.impl;

import com.caption.api.entity.IDCarAuthCondition;
import com.caption.api.entity.IDCarAuthResultDTO;
import com.caption.api.handle.base.AbstractHandler;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

/**
 * 身份认证处理类
 */
public class IDCardAuthHandler extends AbstractHandler {

    private IDCarAuthCondition condition;

    public IDCardAuthHandler(IDCarAuthCondition condition) {
        this.condition = condition;
    }

    @Override
    public IDCarAuthResultDTO call() throws ExecutionException, InterruptedException {
        Future<IDCarAuthResultDTO> future = this.getApiSupport().getCommonExecutor().submit(
                () -> this.getApiSupport().getIdCardAuthClient().call(condition).getData());
        return future.get();
    }
}
